package com.ruoyi.training.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.examination.dto.ExamPaperInfoDto;
import com.ruoyi.examination.vo.ExaminationResultVo;
import com.ruoyi.training.service.IExaminationControlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/examinationControl")
public class ExaminationController extends BaseController {

    @Autowired
    private IExaminationControlService examinationControlService;

    /**
     * 获取考试试卷信息
     * @param trainingClassId
     * @return
     */
    @GetMapping("/classExam/{trainingClassId}")
    public AjaxResult classExam(@PathVariable("trainingClassId") String trainingClassId) {
        ExamPaperInfoDto examPaperInfoDto = examinationControlService.getClassExam(trainingClassId);
        return success(examPaperInfoDto);
    }

    /**
     * 保存考试结果
     * @param examinationResultVo
     * @return
     */
    @PostMapping("/saveExamResult")
    public AjaxResult saveExamResult(@RequestBody ExaminationResultVo examinationResultVo) {
        return success(examinationControlService.saveExamResult(examinationResultVo));
    }
}
